//导入axios二次封装js文件
import axios from "./httpApi.js";

const base = {
    // baseUrl: 'http://localhost:8888',
    baseUrl: "/api", // 利用vue配置代理请求方式
    voluteerCount: "/RandomUser",
    voluteerarea: "/Region",
    consult: "/Announcement",
    login: "/sindex",
    xq: '/xq',
    Announcement5: '/Announcement5',
    team: "/zzlb",
    teamId: "/zzxq",
    menu: "/typelist",
    dateList: '/fwlist',
    getOneToId: "/getOneToId",
    passport: "/vcodes"
};
/**
 * 查询活跃志愿侧
 * @type {{getData(): Promise<AxiosResponse<any>>}}
 */
const banner = {
        async getData() {
            return axios.get(base.baseUrl + base.voluteerCount);
        }
    }
    /**
     * 查询洛阳各个区县的志愿总时间和志愿总人数
     * @type {{getAreaPerson(): Promise<AxiosResponse<any>>}}
     */
const areaPerson = {
        async getAreaPerson() {
            return axios.get(base.baseUrl + base.voluteerarea);
        }
    }
    /**
     * 查询首页公告
     * @type {{getReslut(): Promise<void>}}
     */
const consult = {
        async getReslut(keyword) {
            return axios.get(base.baseUrl + base.consult, { params: { type: keyword } })
        }
    }
    /**
     * 新闻页面
     */
const xq = {
        async getxq(id) {
            // alert(id);
            return axios.get(base.baseUrl + base.xq, { params: { announcementId: id } });
        }
    }
    /**
     * 全部组织查询
     */
const team = {
        async getTeam() {
            return axios.get(base.baseUrl + base.team);
        }
    }
    /**
     * 通过id查询具体组织
     */
const teamId = {
    async getTeamId(id, iphone) {
        return axios.get(base.baseUrl + base.teamId, { params: { id, iphone } });
    }
}
const Announcement5 = {
        async getAnnouncement5() {
            return axios.get(base.baseUrl + base.Announcement5);
        }
    }
    /**
     * 菜单列表
     */
const ActiveMenu = {
    async getMenu() {
        return axios.get(base.baseUrl + base.menu);
    }
};

/**
 * 项目列表
 */
const dateList = {
        async getList(keyword) {
            return axios.get(base.baseUrl + base.dateList, { params: { type: keyword } });
        }
    }
    /**
     * 用户登录接口
     * @type {{getReslut(*=): Promise<AxiosResponse<any>>}}
     */
const login = {
        getReslut(data) {
            return axios.post(base.baseUrl + base.login, data)
        }
    }
    /**
     * 
     */
const OneToId = {
        getOneToId(id, iphone) {
            console.log(iphone);
            return axios.get(base.baseUrl + base.getOneToId, { params: { id: id, iphone } });
        }
    }
    /**
     * 
     */
const passport = {
    getReslut() {
        return axios.get(base.baseUrl + base.passport);
    }
}
export default {
    banner,
    areaPerson,
    consult,
    login,
    passport,
    xq,
    Announcement5,
    team,
    teamId,
    ActiveMenu,
    dateList,
    OneToId
}